package com.huawei.appmarket.service.store.awk.widget.topbanner;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.viewpager.widget.ViewPager;
import o.azb;
import o.dky$o;
import o.Logger;
import o.epr;
import o.epv;

public class DotsViewPager extends ViewPager {
    private int ʻ;
    private int ʼ;
    private int ʽ;
    private int ˊ;
    private int ˋ;
    private float ᐝ;

    public DotsViewPager(Context context) {
        this(context, null);
    }

    public DotsViewPager(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public DotsViewPager(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet);
        this.ˊ = 0;
        this.ʼ = 0;
        this.ᐝ = 1.0f;
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, dky$o.ˈॱ, i, 0);
        this.ˋ = obtainStyledAttributes.getInt(dky$o.ˏͺ, 0);
        obtainStyledAttributes.recycle();
        ᐝ();
    }

    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        onLayout(false, getLeft(), getTop(), getRight(), getBottom());
    }

    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
    }

    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        switch (motionEvent.getAction()) {
            case 0:
                this.ˊ = (int) motionEvent.getRawX();
                this.ʼ = (int) motionEvent.getRawY();
                getParent().requestDisallowInterceptTouchEvent(true);
                break;
            case 2:
                int rawY = (int) motionEvent.getRawY();
                if (Math.abs(((int) motionEvent.getRawX()) - this.ˊ) < Math.abs(rawY - this.ʼ) && Math.abs(rawY - this.ʼ) > getMeasuredHeight() / 10) {
                    getParent().requestDisallowInterceptTouchEvent(false);
                    break;
                }
                getParent().requestDisallowInterceptTouchEvent(true);
                break;
                break;
        }
        return super.dispatchTouchEvent(motionEvent);
    }

    public int ʼ() {
        return this.ˊ;
    }

    public void setFactor(float f) {
        this.ᐝ = f;
    }

    public void onMeasure(int i, int i2) {
        switch (this.ˋ) {
            case 1:
                super.onMeasure(i, i2);
                return;
            default:
                if (epr.ˎ().ॱॱ()) {
                    int size = MeasureSpec.getSize(i);
                    int i3 = azb.ˎ(getContext()) ? this.ʻ : this.ʽ;
                    if (size <= i3) {
                        i3 = size;
                    }
                    Logger.ˎ("DotsViewPager", "width = " + i3);
                    super.onMeasure(MeasureSpec.makeMeasureSpec(i3, 1073741824), MeasureSpec.makeMeasureSpec((int) ((((float) i3) * this.ᐝ) + 0.5f), 1073741824));
                    return;
                }
                super.onMeasure(i, i2);
                return;
        }
    }

    protected void onConfigurationChanged(Configuration configuration) {
        ᐝ();
        super.onConfigurationChanged(configuration);
    }

    private void ᐝ() {
        switch (this.ˋ) {
            case 1:
                return;
            default:
                if (!epv.ʼ(getContext())) {
                    int ॱ = azb.ॱ(getContext());
                    int ॱ2 = epv.ॱ(getContext());
                    this.ʻ = (Math.min(ॱ, ॱ2) * 7) / 10;
                    this.ʽ = (Math.min(ॱ, ॱ2) * 7) / 10;
                    Logger.ˎ("DotsViewPager", "landMaxWidth = " + this.ʻ + " , portMaxWidth = " + this.ʽ);
                    return;
                }
                return;
        }
    }
}
